using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
using WPFExcelReport.Helpers;
using WPFExcelReport.Controls;
namespace WPFExcelReport
{
    public partial class VICC_MAXORD
    {
        public void SetUpNewRow(ref DataRow dwReturn)
        {
            #region
            #endregion
            switch (app.company)
            {
                case "YGR":
                case "SXN":
                case "TST":
                case "UBT":
                default:
                    #region

                    dwReturn["ROWNID"] = "	1	";
                    dwReturn["VKPAUFKRS"] = "		";
                    dwReturn["VKPAUFLFD"] = "		";
                    dwReturn["VKPAUFPOS"] = "		";
                    dwReturn["CUSTOMER"] = "		";
                    dwReturn["VKPNEUDAT"] = "		";
                    dwReturn["VKPNEUTIME"] = "		";
                    dwReturn["NUMBER1"] = "		";
                    dwReturn["NUMBER2"] = "		";
                    dwReturn["NUMBER3"] = "		";
                    dwReturn["NUMBER4"] = "		";
                    dwReturn["NUMBER5"] = "		";
                    dwReturn["CHAR1"] = "		";
                    dwReturn["CHAR2"] = "		";
                    dwReturn["CHAR3"] = "		";
                    dwReturn["CHAR4"] = "		";
                    dwReturn["CHAR5"] = "		";
                    dwReturn["ITEM"] = "0";
                    dwReturn["VKPARTDES"] = "0";
                    dwReturn["VKPFARBE"] = "0";
                    dwReturn["VKPCDES"] = "0";
                    dwReturn["TWIDTH"] = "0";
                    dwReturn["VWIDTH"] = "0";
                    dwReturn["GSQM"] = "0";
                    dwReturn["GM"] = "0";
                    dwReturn["YARN"] = "0";
                    dwReturn["PRICE"] = "0";
                    dwReturn["SPRICE"] = "0";
                    dwReturn["COMPOSITION"] = "0";
                    dwReturn["ORDTYPE"] = "0";
                    dwReturn["QUANTITY"] = "0";
                    dwReturn["VKPNUEBEN"] = "0";
                    dwReturn["REMARK"] = "0";
                    #endregion
                    break;
            }
        }
        public void InsertICC_MAXORD(DataRow dwData, string ITXDBVERSION = "50.24")
        {

            or1 = OracleDB.CreateCommand();
            switch (ITXDBVERSION)
            {
                default:
                case "YGR":
                    or1.CommandText = "INSERT INTO ICC_MAXORD ( ROWNID,VKPAUFKRS,VKPAUFLFD,VKPAUFPOS,ITEM,VKPART,VKPARTDES,VKPFARBE,VKPCDES,TWIDTH,VWIDTH,GSQM,GM,YARN,PRICE,SPRICE,COMPOSITION,ORDTYPE,QUANTITY,CUSTOMER,VKPNEUDAT,VKPNEUTIME,VKPNUEBEN,REMARK,NUMBER1,NUMBER2,NUMBER3,NUMBER4,NUMBER5,CHAR1,CHAR2,CHAR3,CHAR4,CHAR5)"
                    + " VALUES (:ROWNID:,:VKPAUFKRS:,:VKPAUFLFD:,:VKPAUFPOS:,:ITEM:,:VKPART:,:VKPARTDES:,:VKPFARBE:,:VKPCDES:,:TWIDTH:,:VWIDTH:,:GSQM:,:GM:,:YARN:,:PRICE:,:SPRICE:,:COMPOSITION:,:ORDTYPE:,:QUANTITY:,:CUSTOMER:,:VKPNEUDAT:,:VKPNEUTIME:,:VKPNUEBEN:,:REMARK:,:NUMBER1:,:NUMBER2:,:NUMBER3:,:NUMBER4:,:NUMBER5:,:CHAR1:,:CHAR2:,:CHAR3:,:CHAR4:,:CHAR5:)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
            }
            SQLiteDatabase.ExecuteNonQuery(or1.CommandText);
        }
        public DataSet QEXORD01(DataRow dwData)
        {

            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT * FROM ICC_MAXORD WHERE  ROWNID=:ROWNID:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);

            SResult.Tables[0].TableName = "ICC_MAXORD";

            return SResult;
        }
        public void DEXORD01(DataRow dwData)
        {

            or1 = OracleDB.CreateCommand();
            or1.CommandText = "DELETE FROM ICC_MAXORD   WHERE  ROWNID=:ROWNID:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }

        public void UpdateICC_MAXORD(DataRow dwData, string ITXDBVERSION = "50.24", int option = 1)
        {

            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    or1.CommandText = "UPDATE ICC_MAXORD SET ROWNID=:ROWNID:,VKPAUFKRS=:VKPAUFKRS:,VKPAUFLFD=:VKPAUFLFD:,VKPAUFPOS=:VKPAUFPOS:,ITEM=:ITEM:,VKPART=:VKPART:,VKPARTDES=:VKPARTDES:,VKPFARBE=:VKPFARBE:,VKPCDES=:VKPCDES:,TWIDTH=:TWIDTH:,VWIDTH=:VWIDTH:,GSQM=:GSQM:,GM=:GM:,YARN=:YARN:,PRICE=:PRICE:,SPRICE=:SPRICE:,COMPOSITION=:COMPOSITION:,ORDTYPE=:ORDTYPE:,QUANTITY=:QUANTITY:,CUSTOMER=:CUSTOMER:,VKPNEUDAT=:VKPNEUDAT:,VKPNEUTIME=:VKPNEUTIME:,VKPNUEBEN=:VKPNUEBEN:,REMARK=:REMARK:,NUMBER1=:NUMBER1:,NUMBER2=:NUMBER2:,NUMBER3=:NUMBER3:,NUMBER4=:NUMBER4:,NUMBER5=:NUMBER5:,CHAR1=:CHAR1:,CHAR2=:CHAR2:,CHAR3=:CHAR3:,CHAR4=:CHAR4:,CHAR5=:CHAR5:"
                        + " WHERE ROWNID=:ROWNID:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                default:
                    break;
            }
            Connect2Proxy(or1);
        }
    }
}
